<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <title>历史用户意见列表</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/opinionAll.css">
    <script src="${pageContext.request.contextPath}/static/jquery/jquery-3.1.1.js"></script>
    <script src="${pageContext.request.contextPath}/static/jquery/jquery.validate.js"></script>
    <link rel="stylesheet" href="/static/frame/layui/css/layui.css">
    <link rel="stylesheet" href="/static/frame/static/css/style.css">
</head>
<style>
    .showmessages{
        position: absolute;
        width: 100%;
        margin-top:70px;
    }
</style>
<body>
    <div class="titleall">
        <div class="titleph">
            <img src="${pageContext.request.contextPath}/static/images/account.png" style="width:100%;height:100%;"/>
        </div>
        <div class="titleword">历史用户意见处理 >>> 历史用户意见列表</div>
    </div>
    <div class="rolephall1">
        <img src="${pageContext.request.contextPath}/static/images/uservis.png" style="width:100%;height:100%"/>
    </div>
    <form action="selectOpinionAll1" method="post" id="selectuserform">
        <input type="text" class="selectbox" name="userName" placeholder="用户姓名 / Name of user"/>
        <input type="submit" value="查询" class="selectbutton"/>
    </form>
    <div class="contentall">
        <div class="powerword">用户意见信息</div>
        <div class="roleph1">
            <img src="${pageContext.request.contextPath}/static/images/userinfo.png" style="width:100%;height:100%"/>
        </div>
        <input type="button" class="tijiao" value="查看所有/刷新列表"/>
        <%--<div class="handph">--%>
            <%--<img src="${pageContext.request.contextPath}/static/images/handss.png" style="width:100%;height:100%"/>--%>
        <%--</div>--%>
        <input type="button" class="tijiao1" value="只看已审阅"/>
        <div id="tableall" class="showmessages">
            <table class="layui-table">
                <thead>
                <tr class="rolerow">
                    <th style="border:1px solid #999;text-align: center;color:#EC9D1A;font-weight:600;">序号</th>
                    <th style="border:1px solid #999;text-align: center;color:#EC9D1A;font-weight:600;">意见内容</th>
                    <th style="border:1px solid #999;text-align: center;color:#EC9D1A;font-weight:600;">意见用户住所</th>
                    <th style="border:1px solid #999;text-align: center;color:#EC9D1A;font-weight:600;">意见用户姓名</th>
                    <th style="border:1px solid #999;text-align: center;color:#EC9D1A;font-weight:600;">审阅管理员姓名</th>
                    <th style="border:1px solid #999;text-align: center;color:#EC9D1A;font-weight:600;">发布时间</th>
                    <th style="border:1px solid #999;text-align: center;color:#EC9D1A;font-weight:600;">意见审阅时间</th>
                    <th style="border:1px solid #999;text-align: center;color:#EC9D1A;font-weight:600;">意见状态</th>
                    <th style="border:1px solid #999;text-align: center;color:#EC9D1A;font-weight:600;">删除记录</th>
                </tr>
                </thead>
                <tbody id="clear" style="display: none">
                <script>var arr1=[]</script>
                <c:forEach items="${sessionScope.opinionlistAll}" var="opinion" varStatus="sta">
                        <tr id="opiallorder${sta.count}" class="rolerow1">
                            <form method="post" id="opform">
                            <td style="border:1px solid #999;color:#777;font-weight:600">${sta.count}</td>
                            <td style="border:1px solid #999">${opinion.opinion_content}</td>
                            <td style="border:1px solid #999">${hostopinionlist1[sta.count-1].host_building}栋${hostopinionlist1[sta.count-1].host_unit}单元${hostopinionlist1[sta.count-1].host_housenumber}号</td>
                            <td style="border:1px solid #999">${useropinionlist1[sta.count-1].user_name}</td>
                            <c:if test="${opinion.opinion_status==0}">
                            <td style="border:1px solid #999">无</td>
                            </c:if>
                            <c:if test="${opinion.opinion_status==1}">
                                <td style="border:1px solid #999">${adminopinionlist1[sta.count-1].admin_name}</td>
                            </c:if>
                            <td style="border:1px solid #999" class="createtime">${opinion.opinion_createtime}</td>
                            <c:if test="${opinion.opinion_status==0}">
                                <td style="border:1px solid #999">无</td>
                            <td style="border:1px solid #999;color:red;font-style:italic;">未审阅</td>
                            </c:if>
                            <c:if test="${opinion.opinion_status==1}">
                                <td style="border:1px solid #999" class="lasttime">${opinion.opinion_lasttime}</td>
                                <td style="border:1px solid #999;color:green;font-style:italic;">已审阅</td>
                            </c:if>
                            <td style="border:1px solid #999;color:green">
                                <input type="hidden" value="${opinion.opinion_id}" class="yincang"/>
                                <input type="button" value="删除" class="readone" onclick="cl(this,${opinion.opinion_id})" onmouseover="overm(this,${sta.count})"  onmouseout="outm(this,${sta.count})"/>
                            </td>
                            </form>
                        </tr>
                    <script>arr1.push($("#opiallorder${sta.count}")[0])</script>
                </c:forEach>
                </tbody>
                <tbody id="biuuu_city_list"></tbody>
            </table>
            <div id="demo20"></div>
        </div>
    </div>
    <div class="shelter1">
        <div class="succ">
            <div class="tishiph1"><img src="${pageContext.request.contextPath}/static/images/cg.png" style="width:100%;height:100%;"/></div>
            <div class="confirmword1">删除记录成功！</div>
            <div class="close1"><img src="${pageContext.request.contextPath}/static/images/close.png" style="width:100%;height:100%;"/></div>
            <input type="button" class="cf1" value="确定"/>
        </div>
    </div>
    <div class="shelter">
        <div class="succ1">
            <div class="tishiph"><img src="${pageContext.request.contextPath}/static/images/tishi.png" style="width:100%;height:100%;"/></div>
            <div class="confirmword" style="color:red">不能删除未审阅记录！</div>
            <div class="close"><img src="${pageContext.request.contextPath}/static/images/close.png" style="width:100%;height:100%;"/></div>
            <input type="button" class="cf" value="确定"/>
        </div>
    </div>
    <div class="shelter3">
        <div class="confirm3">
            <div class="tishiph3"><img src="${pageContext.request.contextPath}/static/images/tishi.png" style="width:100%;height:100%;"/></div>
            <div class="confirmword3">您确定要删除记录吗？</div>
            <div class="close3"><img src="${pageContext.request.contextPath}/static/images/close.png" style="width:100%;height:100%;"/></div>
            <input type="button" class="cf3" value="确定"/>
        </div>
    </div>
</body>
<script src="${pageContext.request.contextPath}/static/frame/layui/layui.js" charset="utf-8"></script>
<script>
    $(".tijiao").click(function(){
        $.ajax({
            type:'POST',
            url:"${pageContext.request.contextPath}/showAllOpinion.do",
            data:{
            },
            traditional:true,
            dataType:"json",
            success:function(data){
                if(data==true){
                    location.reload(true);
                }
            }
        });
    });
    $(".tijiao1").click(function(){
        $.ajax({
            type:'POST',
            url:"${pageContext.request.contextPath}/showAllfinishedOpinion.do",
            data:{
            },
            traditional:true,
            dataType:"json",
            success:function(data){
                if(data==true){
                    location.reload(true);
                }
            }
        });
    });
    var w=$(window).width();
    var h=$(window).height();
    $(".contentall").innerWidth((w-17)+"px");
    var useropinionlist="${sessionScope.useropinionlist1}";
    if(useropinionlist==""||useropinionlist=="[]"){
        $("#tableall").html("<div class='searchrole'><img src='${pageContext.request.contextPath}/static/images/cry.png'/><div class='noword'>您输入的用户不存在或者该用户没有未审阅的意见信息！</div></div>");
    }
    $(".close3").click(function(){
        $(".shelter3").css("display","none");
        $(".comfirm3").css("display","none");
        window.location.href="${pageContext.request.contextPath}/opinionAll";
    });
    $(".cf1").click(function(){
        $(".shelter1").css("display","none");
        $(".succ").css("display","none");
        window.location.href="${pageContext.request.contextPath}/opinionAll";
    });
    $(".close1").click(function(){
        $(".shelter1").css("display","none");
        $(".succ").css("display","none");
        window.location.href="${pageContext.request.contextPath}/opinionAll";
    });
    $(".cf").click(function(){
        $(".shelter").css("display","none");
        $(".succ1").css("display","none");
        window.location.href="${pageContext.request.contextPath}/opinionAll";
    });
    $(".close").click(function(){
        $(".shelter").css("display","none");
        $(".succ1").css("display","none");
        window.location.href="${pageContext.request.contextPath}/opinionAll";
    });

    function cl(e,index){
        // var ycval=$(".yincang")[index-1].value;
        $(".shelter3").css("display","none");
        $(".comfirm3").css("display","none");
        $(".shelter3").css("display","block");
        $(".comfirm3").css("display","block");
        $(".cf3").click(function(){
            $(".shelter3").css("display","none");
            $(".comfirm3").css("display","none");
            $.ajax({
                type:'POST',
                url:"${pageContext.request.contextPath}/alreadydeleteopinion.do",
                data:{
                    hiddenvalue:index
                },
                traditional:true,
                dataType:"json",
                success:function(data){
                      if(data==true){
                          $.ajax({
                              type:'POST',
                              url:"${pageContext.request.contextPath}/selectopinionalls.do",
                              data:"",
                              traditional:true,
                              dataType:"json",
                              success:function(data1){
                                  if(data1==true){
                                      $(".shelter1").css("display","block");
                                      $(".succ").css("display","block");
                                  }
                              }
                          });
                      }if(data==false){
                          $(".shelter3").css("display","none");
                          $(".comfirm3").css("display","none");
                          $(".shelter").css("display","block");
                          $(".succ1").css("display","block");
                      }
                }
            });
        });
    }
    function nodeToString ( node ) {
        var tmpNode = document.createElement( "div" );
        tmpNode.appendChild( node.cloneNode( true ) );
        var str = tmpNode.innerHTML;
        tmpNode = node = null; // prevent memory leaks in IE
        return str;
    }
    function clear(){
        document.getElementById('clear').innerHTML=null;
    }

    layui.use(['carousel', 'laypage','laydate','form','upload','jquery'], function(){
        var carousel = layui.carousel
            ,form = layui.form
            ,$=layui.jquery
            ,upload = layui.upload
            ,laypage = layui.laypage
            ,laydate=layui.laydate

        //常规轮播
        carousel.render({
            elem: '#test1'
            ,arrow: 'always'
        });
        var data1= arr1;
        laypage.render({
            elem: 'demo20'
            ,count: data1.length
            ,jump: function(obj){
                //模拟渲染
                document.getElementById('biuuu_city_list').innerHTML = function(){
                    var arr = []
                        ,thisData = data1.concat().splice(obj.curr*obj.limit - obj.limit, obj.limit);
                    layui.each(thisData, function(index, item){
                        var itemstr=nodeToString(item);
                        arr.push(itemstr);
                    });
                    clear();
                    return arr.join('');
                }();
            }
        });
    });
    function overm(e,index){
        e.style.backgroundColor="rgba(200,0,0,0.8)";
        e.style.color="white";
    }
    function outm(e,index){
        e.style.backgroundColor="rgba(30,120,0,0)";
        e.style.color="#555";
    }
    $(".selectbox").focus(function(){
        $(".selectbox").css("border","1px solid #333");
    });
    $(".selectbox").focusout(function(){
        $(".selectbox").css("border","1px solid #999");
    });
    showtime();
    function showtime() {
        var createtime=$(".createtime");
        var lasttime=$(".lasttime");
        var passtime=$(".passtime");
        createtime.each(function () {
            //调用时间格式转换函数formatDateTime()
            $(this).text(formatDateTime($(this).text()))
        });
        lasttime.each(function () {
            //调用时间格式转换函数formatDateTime()
            $(this).text(formatDateTime($(this).text()))
        });
        passtime.each(function () {
            //调用时间格式转换函数formatDateTime()
            $(this).text(formatDateTime($(this).text()))
        });
    }
    /**
     *
     * 在页面上，转换时间格式
     * @param inputTime
     * @returns {string}
     */
    function formatDateTime(inputTime) {
        var date = new Date(inputTime);
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        m = m < 10 ? ('0' + m) : m;
        var d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        var h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        var minute = date.getMinutes();
        var second = date.getSeconds();
        minute = minute < 10 ? ('0' + minute) : minute;
        second = second < 10 ? ('0' + second) : second;
        return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second;
    };
</script>
</html>